package com.cml.dm.admin.service;

import com.cml.dm.admin.entity.DmExeLogger;
import com.cml.dm.admin.service.impl.BackupTaskExecutorService;
import com.cml.dm.admin.service.impl.RecoveryTaskExecutorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class TaskExecutorServiceFactory {
    @Autowired
    private RecoveryTaskExecutorService recoveryTaskExecutorService;

    @Autowired
    private BackupTaskExecutorService backupTaskExecutorService;

    public  TaskExecutorService getTaskExecutorService(DmExeLogger dmExeLogger){
        if(dmExeLogger.getExeType().equals(dmExeLogger.backup())){
            return  backupTaskExecutorService;
        }
        return recoveryTaskExecutorService;

    }
}
